package per.sen.shopping.infrastructure.utils;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * @author lys
 * @date 2022/12/28 17:23
 */
public class PhoneUtil {
    private PhoneUtil() {
        //防止该类被实例化
        throw new AssertionError();
    }

    public static boolean checkPhone(String phone) {
        String regExp = "^((110)|(13[0-9])|(14[5,6,7,9])|(15[^4])|(16[0-9])|(18[0-9])|(17[0-8])|(19[0|1|2|3|5|6|7|8|9]))\\d{8}$";
        Pattern p = Pattern.compile(regExp);
        Matcher m = p.matcher(phone);
        return m.matches();
    }
}
